/*
 * Selling Partner API for Replenishment
 * The Selling Partner API for Replenishment (Replenishment API) provides programmatic access to replenishment program metrics and offers. These programs provide recurring delivery of any replenishable item at a frequency chosen by the customer.  The Replenishment API is available worldwide wherever Amazon Subscribe & Save is available or is supported. The API is available to vendors and FBA selling partners.
 *
 * OpenAPI spec version: 2022-11-07
 *
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

package software.amazon.spapi.models.replenishment.v2022_11_07;

import com.google.gson.annotations.SerializedName;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Objects;
import org.threeten.bp.OffsetDateTime;

/**
 * A date-time interval in ISO 8601 format which is used to compute metrics. Only the date is required, but you must
 * pass the complete date and time value. For example, November 11, 2022 should be passed as
 * \&quot;2022-11-07T00:00:00Z\&quot;. Note that only data for the trailing 2 years is supported. **Note**: The
 * &#x60;listOfferMetrics&#x60; operation only supports a time interval which covers a single unit of the aggregation
 * frequency. For example, for a MONTH aggregation frequency, the duration of the interval between the startDate and
 * endDate can not be more than 1 month.
 */
@Schema(
        description =
                "A date-time interval in ISO 8601 format which is used to compute metrics. Only the date is required, but you must pass the complete date and time value. For example, November 11, 2022 should be passed as \"2022-11-07T00:00:00Z\". Note that only data for the trailing 2 years is supported.   **Note**: The `listOfferMetrics` operation only supports a time interval which covers a single unit of the aggregation frequency. For example, for a MONTH aggregation frequency, the duration of the interval between the startDate and endDate can not be more than 1 month.")
public class TimeInterval {
    @SerializedName("startDate")
    private OffsetDateTime startDate = null;

    @SerializedName("endDate")
    private OffsetDateTime endDate = null;

    public TimeInterval startDate(OffsetDateTime startDate) {
        this.startDate = startDate;
        return this;
    }

    /**
     * When this object is used as a request parameter, the specified &#x60;startDate&#x60; is adjusted based on the
     * aggregation frequency. * For &#x60;WEEK&#x60; the metric is computed from the first day of the week (Sunday,
     * based on ISO 8601) that contains the &#x60;startDate&#x60;. * For &#x60;MONTH&#x60; the metric is computed from
     * the first day of the month that contains the &#x60;startDate&#x60;. * For &#x60;QUARTER&#x60; the metric is
     * computed from the first day of the quarter that contains the &#x60;startDate&#x60;. * For &#x60;YEAR&#x60; the
     * metric is computed from the first day of the year that contains the &#x60;startDate&#x60;.
     *
     * @return startDate
     */
    @Schema(
            required = true,
            description =
                    "When this object is used as a request parameter, the specified `startDate` is adjusted based on the aggregation frequency.  * For `WEEK` the metric is computed from the first day of the week (Sunday, based on ISO 8601) that contains the `startDate`. * For `MONTH` the metric is computed from the first day of the month that contains the `startDate`. * For `QUARTER` the metric is computed from the first day of the quarter that contains the `startDate`. * For `YEAR` the metric is computed from the first day of the year that contains the `startDate`.")
    public OffsetDateTime getStartDate() {
        return startDate;
    }

    public void setStartDate(OffsetDateTime startDate) {
        this.startDate = startDate;
    }

    public TimeInterval endDate(OffsetDateTime endDate) {
        this.endDate = endDate;
        return this;
    }

    /**
     * When this object is used as a request parameter, the specified &#x60;endDate&#x60; is adjusted based on the
     * aggregation frequency. * For &#x60;WEEK&#x60; the metric is computed up to the last day of the week (Sunday,
     * based on ISO 8601) that contains the &#x60;endDate&#x60;. * For &#x60;MONTH&#x60;, the metric is computed up to
     * the last day that contains the &#x60;endDate&#x60;. * For &#x60;QUARTER&#x60; the metric is computed up to the
     * last day of the quarter that contains the &#x60;endDate&#x60;. * For &#x60;YEAR&#x60; the metric is computed up
     * to the last day of the year that contains the &#x60;endDate&#x60;. Note: The end date may be adjusted to a lower
     * value based on the data available in our system.
     *
     * @return endDate
     */
    @Schema(
            required = true,
            description =
                    "When this object is used as a request parameter, the specified `endDate` is adjusted based on the aggregation frequency.  * For `WEEK` the metric is computed up to the last day of the week (Sunday, based on ISO 8601) that contains the `endDate`. * For `MONTH`, the metric is computed up to the last day that contains the `endDate`. * For `QUARTER` the metric is computed up to the last day of the quarter that contains the `endDate`. * For `YEAR` the metric is computed up to the last day of the year that contains the `endDate`.  Note: The end date may be adjusted to a lower value based on the data available in our system.")
    public OffsetDateTime getEndDate() {
        return endDate;
    }

    public void setEndDate(OffsetDateTime endDate) {
        this.endDate = endDate;
    }

    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TimeInterval timeInterval = (TimeInterval) o;
        return Objects.equals(this.startDate, timeInterval.startDate)
                && Objects.equals(this.endDate, timeInterval.endDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(startDate, endDate);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class TimeInterval {\n");

        sb.append("    startDate: ").append(toIndentedString(startDate)).append("\n");
        sb.append("    endDate: ").append(toIndentedString(endDate)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /** Convert the given object to string with each line indented by 4 spaces (except the first line). */
    private String toIndentedString(java.lang.Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }
}
